//
//  WoDeMainViewController.m
//  ShangChengMoBan
//
//  Created by 张铁军 on 16/8/13.
//  Copyright © 2016年 ping. All rights reserved.
//

#import "WoDeMainViewController.h"
#import "ME_mainView.h"
#import "MeMoreListViewController.h"
#import "DengLuViewController.h"
#import "DingDanHomeViewController.h"
#import "TuiTypeViewController.h"
#import "YygHomeViewController.h"
#import "ManageViewController.h"
#import "YygFirstViewController.h"
#import "MyPointViewController.h"
#import "ShouCangViewController.h"
@interface WoDeMainViewController ()<ME_mainViewDelegate>
{
    ME_mainView *_mainView;
}
@end

@implementation WoDeMainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置标题
    [self drawNavWithTitle:@"我的"];
    
    [self drawView];
   
}



-(void)drawView{
    _mainView = [[ME_mainView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight - 50)];
    _mainView.delegate = self;
    [self.view addSubview:_mainView];
    
}

-(void)changeUserInfo{
    
}

#pragma mark mainView代理
-(void)buttonClicked:(UIButton *)sender{//设置btn
    if (sender.tag == 0) {
        //设置更多
        if ([self jianCeLogin]) {
            MeMoreListViewController *more = [[MeMoreListViewController alloc] init];
            [self.navigationController pushViewController:more animated:YES];
        }
    }else if (sender.tag == 1){
        //点击头像
        if ([[self defaultLoadUserName]isEqualToString:@""] || ![self defaultLoadUserName]){
            DengLuViewController * login = [[DengLuViewController alloc]init];
            [self.navigationController pushViewController:login animated:YES];
            
        }else{
//            MeZhangHuViewController *zhanghu = [[MeZhangHuViewController alloc] init];
//            [self.navigationController pushViewController:zhanghu animated:YES];
        }
    }
}


-(void)tableClicked:(NSString *)str{
      if ([self jianCeLogin]) {
    if([str isEqualToString:@"我的订单"]){
        [self dingDan:0];
    }else if([str isEqualToString:@"我的话费订单"]){
        
    }
    else if([str isEqualToString:@"FTP一元购"]){
        YygHomeViewController * ding = [[YygHomeViewController alloc]init];
        [self.navigationController pushViewController:ding animated:YES];
    }
    else if([str isEqualToString:@"我的地址"]){
        ManageViewController * jifen = [[ManageViewController alloc]init];
        [self.navigationController pushViewController:jifen animated:YES];
    }
    else if([str isEqualToString:@"我的积分"]){
        MyPointViewController * pon = [[MyPointViewController alloc]init];
        [self.navigationController pushViewController:pon animated:YES];
    }else if([str isEqualToString:@"我的收藏"]){
        ShouCangViewController * pon = [[ShouCangViewController alloc]init];
        [self.navigationController pushViewController:pon animated:YES];
    }
      }

}
-(void)dingDan:(int)a{
    DingDanHomeViewController * ding = [[DingDanHomeViewController alloc]init];
    ding.item = a;
    [self.navigationController pushViewController:ding animated:YES];
}
-(void)dinaDanBtnTapClicked:(UIButton *)sender{
    if ([self jianCeLogin]) {
    switch (sender.tag) {
        case 0:{ //待付款
            [self dingDan:1];
        }
            break;
        case 1:{ //待付款
            [self dingDan:2];
        }
            break;
        case 2:{ //待付款
            [self dingDan:3];
        }
            break;
        case 3:{ //待付款
            [self dingDan:4];
        }
            break;
        case 4:{ //待付款
            TuiTypeViewController * ding = [[TuiTypeViewController alloc]init];
           
            [self.navigationController pushViewController:ding animated:YES];
        }
            break;
        default:
            break;
    }
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
